package com.easy.otc.data;

public class Ccp
{
	private Long ccpId;
	private final String ccpName;
	private final String productType;
	private final String jurisdiction;
	private final String clearingModel;
	private final String key;
	private boolean inActive;

	public Ccp(String name, String productType, String jurisdiction, String clearingModel)
	{
		this(null, name, productType, jurisdiction, clearingModel);
	}

	public Ccp(Long id, String name, String productType, String jurisdiction, String clearingModel)
	{
        this.ccpId = id;
		this.ccpName = name;
		this.productType = productType;
		this.jurisdiction = jurisdiction;
		this.clearingModel = clearingModel;
		this.key = name + "-" + productType + "-" + jurisdiction + "-" + clearingModel;
		
		
	}

	public Long getCcpId()
	{
		return ccpId;
	}

	public void setCcpId(Long id)
	{
		this.ccpId = id;
	}

	public String getCcpName()
	{
		return ccpName;
	}

	public String getProductType()
	{
		return productType;
	}

	public String getJurisdiction()
	{
		return jurisdiction;
	}

	public String getClearingModel()
	{
		return clearingModel;
	}

	@Override
	public int hashCode()
	{
		final int prime = 31;
		int result = 1;
		result = prime * result + ((key == null) ? 0 : key.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
		{
			return true;
		}
		if (obj == null)
		{
			return false;
		}
		if (getClass() != obj.getClass())
		{
			return false;
		}
		Ccp other = (Ccp) obj;
		if (key == null)
		{
			if (other.key != null)
			{
				return false;
			}
		}
		else if (!key.equals(other.key))
		{
			return false;
		}
		return true;
	}

	@Override
	public String toString()
	{
		return key;
	}

	public static Ccp getKey(String ccp, String productType, String jurisdiction, String clearingModel)
	{
		return new Ccp(ccp, productType, jurisdiction, clearingModel);
	}

	public void setInActive(boolean inActive)
	{
		this.inActive = inActive;
	}

	public boolean isInActive()
	{
		return inActive;
	}

}
